package com.xy.biz.fd.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.tool.util.BeanUtilsEx;
import com.xy.biz.fd.domain.bo.DocumentLogBO;
import com.xy.biz.fd.domain.po.DocumentLogPO;
import com.xy.biz.fd.domain.query.DocumentLogQuery;
import com.xy.biz.fd.domain.resp.GetDocumentLogResponse;
import com.xy.biz.fd.domain.req.SaveDocumentLogRequest;
import com.xy.biz.fd.domain.req.ListDocumentLogRequest;

/**
 * 
 * 
 * @author zgy
 * @date 2021-5-20
 */
public class DocumentLogConverter {
	
	public static DocumentLogPO toPO(DocumentLogBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentLogPO(), true);
	}
	
	public static List<DocumentLogPO> toPO(Collection<DocumentLogBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentLogPO(), true);
	}
	
	public static DocumentLogBO fromPO(DocumentLogPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentLogBO());
	}
	
	public static List<DocumentLogBO> fromPO(Collection<DocumentLogPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentLogBO());
	}
	
	public static DocumentLogBO toBO(SaveDocumentLogRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentLogBO(), true);
	}
	
	public static List<DocumentLogBO> toBO(Collection<SaveDocumentLogRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentLogBO(), true);
	}
	
	public static GetDocumentLogResponse toResponse(DocumentLogBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetDocumentLogResponse());
	}
	
	public static List<GetDocumentLogResponse> toResponse(Collection<DocumentLogBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetDocumentLogResponse());
	}
	
	public static DocumentLogQuery toQuery(ListDocumentLogRequest source) {
		if(null == source) {
			return null;
		}
		DocumentLogQuery target = new DocumentLogQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
